<?php

declare(strict_types=1);


namespace app\controller\admin;

use app\result\SettingResult;
use think\App;

/**
 * 配置项
 */
class Setting extends BaseAdmin
{
    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->objResult = new SettingResult();
    }

    public function list()
    {
        data_exit_json($this->objResult->list($this->param));
    }

    /**
     * 获取配置信息
     * @return void
     */
    public function get()
    {
        data_exit_json($this->objResult->info($this->param['id'] ?? '0'));
    }


    /**
     * 更新配置项
     * @return void
     */
    public function save_data()
    {
        data_exit_json($this->objResult->action($this->param));
    }

    public function delete()
    {
        data_exit_json($this->objResult->delete($this->param['id']));
    }

    //菜单
    public function menu_list()
    {
        data_exit_json($this->objResult->menu_list());
    }

    public function admin_info()
    {
        data_exit_json($this->objResult->admin_info($this->admin_id));
    }

    public function change_password()
    {
        data_exit_json($this->objResult->change_password($this->admin_id, $this->param['password'] ?? '', $this->param['password1'] ?? ''));
    }
}
